package com.atguigu.springboot.service.impl;

import com.atguigu.springboot.service.IAsyncService;
import lombok.AllArgsConstructor;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

/**
 * @author : wenchao.long
 * @date : Created in 2020/12/02 17:48 周三
 * @description :
 *         <p>
 *         注解：@Async告诉Spring这是一个异步方法
 *         </p>
 */
@Service
@AllArgsConstructor
public class AsyncServiceImpl implements IAsyncService {

    @Override
    @Async
    public void hello() {
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("处理数据。。。");
    }
}
